﻿using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Windows.Forms;

namespace MultiVolumeControl.Core
{
	/// <summary>
	/// Utility class for handling unmanaged calls to Win32 functions
	/// </summary>
	public static class Win32Utils {
		
		public static readonly int WM_HOTKEY = 0x0312;
		
		[DllImport("Kernel32.dll")]
		public extern static void GetSystemTime(ref SystemTime systemTime);
		
		[DllImport("user32.dll")]
		private extern static bool RegisterHotKey(IntPtr hWnd, int id, uint fsModifiers, uint vk);
		
		internal static bool RegisterHotKey(IWin32Window window, int id, ModifierKeys modifier, Keys key){
			return RegisterHotKey(window.Handle, id, (uint)modifier, (uint)key);
		}
		
		[DllImport("user32.dll")]
		private extern static bool UnregisterHotKey(IntPtr hWnd, int id);
		
		internal static bool UnregisterHotKey(IWin32Window window, int id){
			return UnregisterHotKey(window.Handle, id);
		}
	}
}